package com 
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.text.TextFormat;
	
	/**
	 * ...
	 * @author Mohan Patil
	 */
	public class AdvTextBoxTest extends MovieClip 
	{
		var txtFormat:TextFormat = new TextFormat();
		var adv:AdvTextBox;
		
		public function AdvTextBoxTest() 
		{
			//txtFormat.size = 14;
			//txtFormat.font = "Verdana";
			//txtFormat.leading = 20;
			
			//mcRed.addEventListener(MouseEvent.MOUSE_DOWN, mcRed_MouseDown);
			//mcRed.addEventListener(MouseEvent.MOUSE_UP, mcRed_MouseUp);
			
			//=============== Following block is used to test MathML functionality. =================================
			//var formula:MathPanel = new MathPanel();
			//formula.x = txtData.x + rect1.x;
			//formula.y = txtData.y + rect1.y + rect1.height / 2;
			//formula.drawFormula("<mathml><mi>x</mi><mo>+</mo><mi>y</mi></mathml>", 24);
			//PlaceHolderItem(_placeHolderObjects[i]).object = formula;
			//this.addChild(formula);
			
			/*//MathML.setUrlFonts("D:\Data\Mohan\Projects\SessionQuiz\02072013");
			//MathML.setUrlFontsRelativeToSwfRoot("D:/Data/Mohan/Projects/SessionQuiz/02072013/fontswf");
			//MathML.setUrlFonts(loaderInfo.url);
			//MathML.setUrlFontsRelativeToSwfRoot(loaderInfo.url);
			var drawPanel:MovieClip = new MovieClip();
			var style:Style = new Style();
			style.size = 24;//defaultSize;
			style.mathvariant = "normal"//"Arial Unicode Ms";
			style.color = "#000000";
			//var xmlData:XML = new XML("<mathml><mi>x</mi><mo>+</mo><mi>y</mi></mathml>");
			var xmlData:XML = new XML("<mathml><mfrac><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mrow><mi>x</mi><mo>-</mo><mi>y</mi></mrow></mfrac></mathml>");
			trace(xmlData);
			var mathML:MathML  = new MathML(xmlData, style);
			this.addChild(drawPanel);
			drawPanel.x = 200;
			drawPanel.y = 200;
			mathML.drawFormula(drawPanel, callbackFunct);*/
			//======================================================================================================
			
			init1();
		}
		
		/*private function mcRed_MouseUp(e:MouseEvent):void 
		{
			mcRed.stopDrag();
		}
		
		private function mcRed_MouseDown(e:MouseEvent):void 
		{
			mcRed.startDrag();
		}*/
		
		private function init1():void 
		{	
			//var str:String = "Specifies whether to {B_10} use global {M_5_<mathml><mfrac><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mrow><mi>x</mi><mo>-</mo><mi>y</mi></mrow></mfrac></mathml>} matching <b>for</b> the regular expression {D_13_T:Item 1|T:Item 2|M:<mathml><msup><mi>x</mi><mn>2</mn></msup></mathml>|T:Item 4} .";
			//var str:String = "Specifies whether to {P_1} use global {P_2} matching <b>for</b> the regular expression {P_3}.";
			//var str:String = "Specifies whether to use global matching for the regular expression";
			//var str:String = "<textformat leading=\"15\">Solve this equation by selecting {M_7_<mathml><mfrac><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mrow><mi>x</mi><mo>-</mo><mi>y</mi></mrow></mfrac><mo>=</mo><mn>2</mn></mathml>} is {B_10_data_exactly} the correct answers from the drop-down lists.<br>{M_7_<mathml><mfrac><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mrow><mi>x</mi><mo>-</mo><mi>y</mi></mrow></mfrac><mo>=</mo><mn>2</mn></mathml>}  </textformat>{D_13_T:Item 1|T:Item 2|M:<mathml><msup><mi>x</mi><mn>2</mn></msup></mathml>|T:Item 4_1|0}";
			//var str:String = "Select the correct options and complete the solution. Consider the following data in two variables that is age of wife(X) and age of {M_10_<math><msup><mi>x</mi><mn>2</mn></msup></math>} husband(Y) at the time of marriage. sdf";
			
			//var str:String = "<textformat leading=\"15\">Select the correct options and complete the solution. {M_10_<math><msup><mi>x</mi><mn>2</mn></msup></math>} Select the correct options and complete the solution. Select the correct options and complete the solution.<br> Select the correct options and complete the solution. {M_10_<math><msup><mi>x</mi><mn>2</mn></msup></math>} solve </textformat>";
			
			var str:String = "<textformat leading=\"15\">Select <font face=\"Rupee Foradian\">`</font>41 the ?_______ correct options and {M_7_<math mathvariant=\"Verdana\"><msup><mtext>GDP</mtext><mtext>MP</mtext></msup></math>} complete the solution. Consider the {B_10_correct} following data in two variables that is age of wife(X) and age of husband(Y) at the time of marriage ?_________.<br><br><br>{M_5_<math> <mtable frame=\"solid\" rowlines=\"solid\" columnlines=\"solid\"> <mtr> <mtd> <mtext>2</mtext> </mtd> <mtd> <mtext selected=\"true\">2</mtext> </mtd> </mtr> <mtr> <mtd> <mtext>3</mtext> </mtd> <mtd> <mtext>2</mtext> </mtd> </mtr> <mtr> <mtd> <mtext>4</mtext> </mtd> <mtd> <mtext>2</mtext> </mtd> </mtr> </mtable> </math>}</textformat>"
			
			/*var a:BlankSpace = new BlankSpace();
			var b:MathEquation = new MathEquation("<mathml><mi>x</mi><mo>+</mo><mi>y</mi></mathml>");
			var d:AdvDropDown = new AdvDropDown("Verdana", 12, loaderInfo, 100);
			d.addItem(new AdvDropDownItem(0, "text", "Item 1"));
			d.addItem(new AdvDropDownItem(1, "text", "Item 2"));
			d.addItem(new AdvDropDownItem(2, "math", "<mathml><msup><mi>x</mi><mn>2</mn></msup></mathml>"));
			d.addItem(new AdvDropDownItem(1, "text", "Item 4"));
			d.createItems();*/
			
			adv = new AdvTextBox(str, txtFormat, 900, 0xFFFFFF, false);;
			adv.addEventListener(AdvTextBoxEvent.RENDER_COMPLETE, adv_renderComplete);
			adv.createObject();
			this.addChild(adv);
			//this.setChildIndex(mcRed, this.numChildren - 1);
			adv.x = 50;
			adv.y = 200;
		}
		
		private function adv_renderComplete(e:AdvTextBoxEvent):void 
		{
			//adv.changePlaceHolderColorForHiding(0xFF0000);
		}
	}
}